//============================================================================
// Name        : Feb22.cpp
// Author      : Anthony Varghese
// Version     : 1
// Copyright   : If you change this, add your name to the list of names for authors
// Description : Simple C++ class with overloading
//============================================================================

#include <iostream>
using namespace std;

class MyData{
public:
    MyData(){}
    MyData(const int s){
        for (int i=0; i<10; i++)
            cloud[i] = s;
    }
    MyData(const float array[10]){
        for (int i=0; i<10; i++)
            cloud[i] = array[i];
    }
    void print() const {
        for (int i=0; i<10; i++)
            cout << cloud[i] << " ";
        cout << endl;
    }
    friend const MyData operator +(const MyData op1, const MyData op2);

 /*   const MyData operator +(const MyData op) const {
        float result[10];
        for (int i=0; i<10; i++)
            result[i] = cloud[i] + op.cloud[i];
        return MyData( result );
    }
  */
    MyData operator -(const MyData& op) const {
        float result[10];
        for (int i=0; i<10; i++)
            result[i] = cloud[i] - op.cloud[i];
        return MyData( result );
    }
    friend MyData operator-(const MyData& a);
/*    MyData operator -(){
        float result[10];
        for (int i=0; i<10; i++)
            result[i] = - cloud[i];
        return MyData( result );
    }
 */
private:
    float cloud[ 10 ];
};

MyData operator -(const MyData& a){
    float result[10];
    for (int i=0; i<10; i++)
        result[i] = - a.cloud[i];
    return MyData( result );
}

const MyData operator +(const MyData op1 , const MyData op2) {
        float result[10];
        for (int i=0; i<10; i++)
            result[i] = op1.cloud[i] + op2.cloud[i];
        return MyData( result );
    }
int main() {
    MyData x( 10 );

    float d[10] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    MyData y( d );

    x.print();
    y.print();

    //MyData p = x + y;

    MyData q = 2 + y;

//    MyData z = x - y;

//   MyData a = -y;

    q.print();
    return 0;
}
